import adaptation.FruitsAdaptation;
import dao.Apple;
import dao.Fruits;
import dao.Mango;
import dao.Strawberry;


public class main {

    public static void main(String[] args) {
        FruitsAdaptation fruitsAdaptation = new FruitsAdaptation();
        Apple apple = new Apple("苹果", 10, 8.0, 1.0);
        Strawberry strawberry = new Strawberry("草莓", 10, 13.0, 1.0);
        Mango mango = new Mango("芒果", 10, 20.0, 1.0);

        // 题目1
        Double applePrice = fruitsAdaptation.calculation(apple);
        Double strawberryPrice = fruitsAdaptation.calculation(strawberry);
        Double price = calculationFruitsTotal(applePrice, strawberryPrice);
        System.out.println(price);

        // 题目2
        Double mangoPrice = fruitsAdaptation.calculation(mango);
        price = calculationFruitsTotal(applePrice, strawberryPrice, mangoPrice);
        System.out.println(price);

        // 题目3
        strawberry.setDiscount(0.8);
        strawberryPrice = fruitsAdaptation.calculation(strawberry);
        price = calculationFruitsTotal(applePrice, strawberryPrice, mangoPrice);
        System.out.println(price);

        // 题目4
        price  = fruitsAdaptation.calculationReduction(price, 100.0, 10.0);
        System.out.println(price);
    }

    public static Double calculationFruitsTotal(Double... Price) {
        Double total = 0.0;
        for (Double aDouble : Price) {
            total += aDouble;
        }
        return total;
    }
}
